<template>
	<view class="">

		<view style="width: 100%; margin-top: 30rpx;">
			<!-- <view @tap="back" class="gui-icons back_icon">&#xe600;</view> -->
			<view class="tab" style="">
				<view v-for="(t,i) in tabs" class="tab_item" @tap="tab_change(i)"
					:class="i==tab_index?'tab_item_action':''">
					{{t.name}}
				</view>
			</view>
		</view>

		<view v-if="list.length <= 0" class="gui-margin-top gui-padding gui-text-center gui-color-gray">
			暂无数据
		</view>

		<view v-for="(d,i) in list" v-else
			style="display: flex;justify-content: space-between;padding: 20rpx;font-size: 30rpx;">
			<view class="" style="padding-left: 30rpx;">
				<view>{{d.name}}</view>
				<view class="gui-color-gray gui-text-small">时间：{{d.crtTime}}</view>
			</view>
			<view class="gui-icons gui-color-gray gui-text-center">
				&#xe601;
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				tabs: [{
						name: '我的帮扶',
						type: 1,
						url: "/APP/assistRegister/queryPage",
						page_index: 1
					},
					{
						name: '互助保障',
						type: 2,
						url: "/APP/helpEachother/queryPage",
						page_index: 1
					},
					{
						name: '医保参保',
						type: 3,
						url: "/APP/medicalInsurance/queryPage",
						page_index: 1
					},
					{
						name: '会员慰问',
						type: 9,
						url: "/APP/memberSympathy/queryPage",
						page_index: 1
					}
				],
				tab_index: 0,
				list: [],
			}
		},
		onLoad() {
			this.tab_change(this.tab_index)
		},
		methods: {
			back() {
				uni.navigateBack()
			},
			tab_change(n) {
				console.log('i: ', n);
				this.tab_index = n;
				console.log('this.tab_index: ', this.tab_index);
				uni.showLoading({
					title: '加载中'
				});
				this.list = [];
				this.get_data();
			},
			get_data() {
				let d = this.tabs[this.tab_index];
				let self = this;
				this.$lg.Get(d.url, {
					page: d.page_index,
					pageSize: 20,
					type: d.type
				}, function(res) {
					console.log('权益保障res：', res);
					self.list = res.data.rows;
					uni.hideLoading();
				}, err => {
					console.log('权益保障err: ', err);
				}, false, false)
			}
		}
	}
</script>

<style>
	page {
		width: 100vw;
		height: 100vh;
		background: url("https://boyaltd.oss-cn-hangzhou.aliyuncs.com/bj_liand.png") 100% 100% / 100% 100%;
		/* background-repeat:no-repeat; */
	}

	.tab {
		width: 100%;
		display: flex;
		/* margin-left: 130rpx; */
		/* align-content: center; */
		justify-content: space-evenly;
	}

	.tab_item {
		padding: 12rpx 22rpx;
		border-radius: 16rpx;
		background-color: white;
		color: #666666;
		border: 1px solid #c6c6c6;
	}

	.tab_item_action {
		box-shadow: 5rpx 5rpx 8rpx #666666;
		border: 1px solid #F27A43;
		background-color: #F27A43;
		color: white;
		font-weight: bold;
	}

	.back_icon {
		color: #333333;
		width: 100rpx;
		font-size: 50rpx;
		text-align: center;
		font-weight: bold;
		display: flex;
		justify-items: center;
		align-items: center;
		justify-content: center;
	}
</style>